import React, { Component } from 'react'
import Counter from './Counter'
import Button from './Button'
export default class App extends Component {
  state = {
    counter: 100
  }
  render() {
    return (
      <div>
        <Counter counter={this.state.counter} />
        <Button click={(data) => this.add(data)} />
      </div>
    )
  }

  add(data) {
    this.setState((state) => {
      return {
        counter: state.counter + data
      }
    })
  }
}
